package com.gmscosmo.janus.netty;

import io.netty.channel.Channel;
import org.springframework.stereotype.Component;

import java.util.concurrent.ConcurrentHashMap;

@Component
public class ConnectionManager {
    private static ConcurrentHashMap<String, Channel> channelGroup = new ConcurrentHashMap(16);

    public void put(String name,Channel channel){
        channelGroup.put(name,channel);
    }
    public void remove(String name){
        channelGroup.remove(name);
    }
    public Channel get(String name){
        if(!channelGroup.containsKey(name)){
            return null;
        }
       return channelGroup.get(name);
    }
}
